package org.mobai.flow.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 实现方式
 *
 * @author mobai
 */
@AllArgsConstructor
@Getter
public enum ImplementationEnum {
    CLASS("class"),
    EXPRESSION("expression"),
    DELEGATE_EXPRESSION("delegateExpression");

    private String type;
    private static final Map<String, ImplementationEnum> IMPLEMENTATION_ENUM_MAP = new HashMap<>();

    static {
        for (ImplementationEnum value : ImplementationEnum.values()) {
            IMPLEMENTATION_ENUM_MAP.put(value.getType(), value);
        }
    }

    public static ImplementationEnum getByType(String type) {
        return IMPLEMENTATION_ENUM_MAP.get(type);
    }
}
